﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace WorkingTitleDungeonCrawler
{
    class Explosion : GameObj
    {
        // Constructor
        public Explosion()
        {
            Time = 0;
            Frame = 0;
            Active = true;
            AnimationSpeed = 30;
            Angle = 0;
            
        }

        // Properties
        public int Time { get; set; }
        public int Frame { get; set; }
        public int AnimationSpeed { get; set; }
        public bool Active { get; set; }
        public override double Radius{get{return (26.0);}set{}}

        // Methods
        public void Update(GameTime gameTime)
        {
            Time += gameTime.ElapsedGameTime.Milliseconds;
            if (Time > AnimationSpeed)
            {
                Time = 0;
                Frame++;
                if (Frame > 15)
                {
                    Active = false;
                }
            }
        }

        public override void Draw(SpriteBatch spritebatch, Vector2 DrawOffset)
        {
            Rectangle tmp = new Rectangle((Frame % 4) * 64, (Frame / 4) * 64, 64, 64);

            spritebatch.Draw(Gfx, Position - DrawOffset + new Vector2(400, 300),
                tmp, Color.White, base.Angle,
                new Vector2(32, 32), 1.0F, SpriteEffects.None, 0);
        }

    }
}
